﻿using System;
using System.Collections.Generic;
using Castle.ActiveRecord;

namespace SampleApplication
{
    /// <summary>
    /// Encja wypożyczenia
    /// </summary>
    [ActiveRecord]
    public class Rental : ActiveRecordBase<Rental>
    {
        /// <summary>
        /// Id wypożyczenia
        /// </summary>
        [PrimaryKey]
        public int Id { get; set; }

        /// <summary>
        /// Klient
        /// </summary>
        [BelongsTo]
        public Customer Customer { get; set; }

        /// <summary>
        /// Data wypożyczenia
        /// </summary>
        [Property]
        public DateTime SubmitDate { get; set; }

        /// <summary>
        /// Data oddania
        /// </summary>
        [Property]
        public DateTime FinishedDate { get; set; }

        /// <summary>
        /// Stan wypożyczenia
        /// </summary>
        [Property]
        public RentalState State { get; set; }

        /// <summary>
        /// Kwota wypożyczenia
        /// </summary>
        [Property]
        public double RentalAmount { get; set; }

        /// <summary>
        /// Składowe wypożyczenia
        /// </summary>
        [HasMany]
        public IList<RentalItem> RentalItems { get; set; }

        /// <summary>
        /// Konstruktor
        /// </summary>
        public Rental()
        {
            RentalItems = new List<RentalItem>();
            SubmitDate = new DateTime(1980, 1, 1);
            FinishedDate = new DateTime(1980, 1, 1);
        }
    }
}
